*** CREATE DOCTORS TABLE ***

create table DoctorsIowa
(
id integer constraint PK_DoctorsIowa PRIMARY KEY,
drfirstname text(20),
drlastname text(30),
hourly currency

)


*** CREATE PATIENTS TABLE ***

create table PatientsIowa
(
patientID integer CONSTRAINT PK_PatientIDIowa PRIMARY KEY,
firstname text(20),
lastname text(30),
doctorID integer
)

*** CREATE FOREIGN KEY ***

ALTER TABLE PatientsIowa
ADD CONSTRAINT FK_Doctors
FOREIGN KEY (doctorID) REFERENCES DoctorsIowa (id)


*** CREATE AN INDEX ***

create index FK_PATIENTSIowa
on PatientsIowa
(
doctorID ASC

)
WITH DISALLOW NULL

